package org.tinygroup.channel.protocol.impl;

import org.tinygroup.channel.protocol.ProtocolListener;
import org.tinygroup.context.Context;

public abstract class AbstractProtocolListener<Request, Response> implements ProtocolListener<Request, Response>{
	private String id;
	public void pre(Request request, Context context, ProtocolListenerChain chain) {
		preProcess(request, context);
		chain.pre(request, context);
	}
	
	abstract protected void preProcess(Request request, Context context) ;

	public void post(Request request, Response response, Context context,
			ProtocolListenerChain chain) {
		postProcess(request, response, context);
		chain.post(request, response, context);
	}
	abstract protected void postProcess(Request request, Response response, Context context) ;
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

}
